import numpy as np


# data

def load_data(filepath):
    data = []
    with open(filepath, "rt") as f:
        lines = f.readlines()
        for line in lines:
            data.append(line.strip().split())

    data = np.array(data).astype(np.float32)

    Y = data[:, -1]
    X = data[:, 0:-1]

    # print(data)
    # print(data.shape)

    return X, Y


def split_train_test(X, Y):
    X_train = X[0:496, ...]
    Y_train = Y[0:496, ...]

    X_test = X[496:, ...]
    Y_test = Y[496:, ...]

    # print("Y_test: ", Y_test)

    return X_train, X_test, Y_train, Y_test
